/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MODEL;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ahmed
 */
@Entity
@Table(name = "ACHETER")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Acheter.findAll", query = "SELECT a FROM Acheter a"),
    @NamedQuery(name = "Acheter.findByIdC", query = "SELECT a FROM Acheter a WHERE a.acheterPK.idC = :idC"),
    @NamedQuery(name = "Acheter.findByIdItem", query = "SELECT a FROM Acheter a WHERE a.acheterPK.idItem = :idItem"),
    @NamedQuery(name = "Acheter.findByQuantiterA", query = "SELECT a FROM Acheter a WHERE a.quantiterA = :quantiterA"),
    @NamedQuery(name = "Acheter.findByDateA", query = "SELECT a FROM Acheter a WHERE a.dateA = :dateA")})
public class Acheter implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AcheterPK acheterPK;
    @Basic(optional = false)
    @Column(name = "QUANTITER_A")
    private BigInteger quantiterA;
    @Basic(optional = false)
    @Column(name = "DATE_A")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateA;
    @JoinColumn(name = "ID_C", referencedColumnName = "ID_C", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Client client;

    public Acheter() {
    }

    public Acheter(AcheterPK acheterPK) {
        this.acheterPK = acheterPK;
    }

    public Acheter(AcheterPK acheterPK, BigInteger quantiterA, Date dateA) {
        this.acheterPK = acheterPK;
        this.quantiterA = quantiterA;
        this.dateA = dateA;
    }

    public Acheter(String idC, BigInteger idItem) {
        this.acheterPK = new AcheterPK(idC, idItem);
    }

    public AcheterPK getAcheterPK() {
        return acheterPK;
    }

    public void setAcheterPK(AcheterPK acheterPK) {
        this.acheterPK = acheterPK;
    }

    public BigInteger getQuantiterA() {
        return quantiterA;
    }

    public void setQuantiterA(BigInteger quantiterA) {
        this.quantiterA = quantiterA;
    }

    public Date getDateA() {
        return dateA;
    }

    public void setDateA(Date dateA) {
        this.dateA = dateA;
    }

    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (acheterPK != null ? acheterPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Acheter)) {
            return false;
        }
        Acheter other = (Acheter) object;
        if ((this.acheterPK == null && other.acheterPK != null) || (this.acheterPK != null && !this.acheterPK.equals(other.acheterPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "MODEL.Acheter[ acheterPK=" + acheterPK + " ]";
    }
    
}
